From bedecf22406ffd31f93170596b91fab5f047fc69 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Thu, 21 Apr 2011 14:39:45 +0000 Subject: [PATCH] (bug 27833) CollapsibleTabs doesn't collapse tabs due to JS errors * Change remove() to detach() so .data() isn't lost * Be more careful using the parent's .data() in addData() * Change ele (which mysteriously isn't available in the closure) to this, they're the same anyway --- resources/jquery/jquery.collapsibleTabs.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/resources/jquery/jquery.collapsibleTabs.js b/resources/jquery/jquery.collapsibleTabs.js index 47811b02f4..1c68250053 100644 --- a/resources/jquery/jquery.collapsibleTabs.js +++ b/resources/jquery/jquery.collapsibleTabs.js @@ -49,12 +49,14 @@ }, addData: function( $collapsible ) { var $settings = $collapsible.parent().data( 'collapsibleTabsSettings' ); - $collapsible.data( 'collapsibleTabsSettings', { - 'expandedContainer': $settings.expandedContainer, - 'collapsedContainer': $settings.collapsedContainer, - 'expandedWidth': $collapsible.width(), - 'prevElement': $collapsible.prev() - } ); + if ( typeof $settings != 'undefined' ) { + $collapsible.data( 'collapsibleTabsSettings', { + 'expandedContainer': $settings.expandedContainer, + 'collapsedContainer': $settings.collapsedContainer, + 'expandedWidth': $collapsible.width(), + 'prevElement': $collapsible.prev() + } ); + } }, getSettings: function( $collapsible ) { var $settings = $collapsible.data( 'collapsibleTabsSettings' ); @@ -95,7 +97,7 @@ var dataExp = $.collapsibleTabs.getSettings( data.expandedContainer ); dataExp.shifting = true; $moving - .remove() + .detach() .prependTo( data.collapsedContainer ) .data( 'collapsibleTabsSettings', data ); dataExp.shifting = false; @@ -107,7 +109,7 @@ var dataExp = $.collapsibleTabs.getSettings( data.expandedContainer ); dataExp.shifting = true; // remove this element from where it's at and put it in the dropdown menu - $moving.remove().insertAfter( data.prevElement ).data( 'collapsibleTabsSettings', data ); + $moving.detach().insertAfter( data.prevElement ).data( 'collapsibleTabsSettings', data ); dataExp.shifting = false; $.collapsibleTabs.handleResize(); } -- 2.20.1